/* eslint-disable */
let { list } = require('./src/mock')
const bodyParser = require('body-parser')
module.exports = {
	devServer: {
		before(app) {
			app.use(bodyParser.json())

			app.get('/api/message/lists', (req, res) => {
				res.send({
					code: 200,
					data: list
				})
			})

			app.post('/api/message/list', (req, res) => {
				req.body.id = Math.random();

				list.unshift(req.body);
				res.send({
					code: 200,
					mess: '发表成功'
				})
			})
		}
	}
}